#{extends 'main.html' /}
#{set title:'Electronic Voting homepage' /}
#{if user==null}
<h1>GUC Voting System</h1><br>
<a href="/login">Login</a>
<a href="/users/blank">Register</a>
#{/if}
#{else}
#{if !user.isActivated}
<h1>Please Activate your account.</h1>
#{/if}
#{else}

<h1>GUC E-Vote</h1><br>
#{if (nvoted.size()+voted.size())!=0}
#{if nvoted.size()!=0}
<h2>Elections that You didnt vote for:</h2><br>
#{list items:nvoted, as:'election'}
#{if !election.isEnded}
<b>*</b><a href="/Questions/ViewElection?id=${election.id}">${election.Title}</a><br>
#{/if}
#{/list}
#{/if}
#{else}
<h2>There was no elections that you didn't vote for </h2>
#{/else}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#{if voted.size()!=0}
<h2>Elections You have Voted for:</h2></h2><br>
#{list items:voted, as:'nv'}
#{if !nv.isEnded}
<b>*</b><a href="/Questions/ViewVote?id=${nv.id}">${nv.Title}</a><br>
#{/if}
#{/list}
#{/if}

#{else}
<h2>You have never voted for any of the offered elections </h2>
#{/else}
#{/if}
#{else}
<h2>There are no running elections now days.</h2>
#{/else}
#{if thereended}
<h2>Previous elections results</h2>
#{list items:elections, as:'elec'}
#{if elec.isEnded}
<b>*</b><a href="/Questions/Viewresult?id=${elec.id}">${elec.Title}</a>
#{/if}
#{/list}
#{/if}
#{if user.isAdmin}
<br><br><br>
<a href="/questions/blank">Add a new election question</a>
<br>
<a href="/candidates/blank">Add a new candidate to any question</a>

#{/if}
#{/else}
#{/else}